import RandomUtil from '@/RandomUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 龙虾 - 虾螯
 **/
export default class MSK_XiaAo extends AbilityBase {
    static instance: MSK_XiaAo;
    constructor(id: string = 'Mxt3') {
        super(id);
        MSK_XiaAo.instance = this;
        this.init();
        // se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
        EventManager.onTakeAttack(this.onSpellEffect.bind(this));
    }
    init() {}
    onSpellEffect(d: DamageEventData) {
        if (!d.isAttack && d.isAttach) return;
        if (GetUnitAbilityLevel(d.target, this.id) == 0) return;
        let r = RandomUtil.randomPercent();
        let rate = 0;
        if (r > 0.5) {
            rate = 0.5;
        } else if (r > 0.75) {
            rate = 1;
        } else {
            rate = 1.5;
        }
        DamageSystemInstance.applyPhysicalDamage(d.source, d.target, d.lastDamage * rate);
    }
}
